<html>
<head>
<title>EMF Data Bindings</title>
<meta content="text/html; charset=windows-1252" http-equiv="Content-Type">
<link href="../../../../book.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#FFFFFF">
    <h1>EMF Data Bindings</h1>
	<h3>Supported for Eclipse 3.3 
	and above only</h3>
	<p class="pnoall">Click the
	<b>Bindings</b> tab in the editor to created and edit 
	data bindings.</p>
	<p class="pnoall">
	<img border="0" src="../../../wizards/databinding/images/data_binding_tab.gif" align="absbottom"></p>
	<p class="pnoall">
	<img border="0" src="images/data_binding_emf1.gif"></p>
	<p class="pnoall">SWT uses simple bindings between targets and models. </p>
	<h2>Target &amp; Model Types</h2>
	<p class="pnoall">In addition to the standard <b>Beans</b> and <b>Widgets</b> 
	bindings, and additional EMF binding type is available when EMF 
	projects/model objects are detected.</p>
	<p class="pnoall"><b>
	<img border="0" src="images/data_binding_emf_button.gif" align="absbottom" width="23" height="20"> 
	Eclipse Modeling Framework (EMF)</b>: any EMF model object present in the current compilation unit may be selected. 
		The filter field above the list can be used to filter the list of models. 
		The
	<img border="0" src="images/clear_filter_button.gif" width="23" height="22" align="absbottom"> 
		clear button can be used to clear the filter and restore the full list.<br>
	<br><img border="0" src="images/model_emf.gif" width="213" height="240">&nbsp;&nbsp;
	<br>&nbsp;</p>
	<h2>Properties</h2>
	<p class="pnoall">When any <b>Target</b> or <b>Model</b> object is selected, 
	its EMF model properties are shown 
	in the associated <b>Properties</b> list. A drop down filter menu is 
	available to filter the Property list by type. Supported filters are <b>
	String</b>, <b>Boolean</b>, <b>Numbers</b>, <b>Color</b> and <b>Font</b>.</p>
	<p class="pnoall">
	<img border="0" src="images/properties_emf1.gif">&nbsp;&nbsp; &nbsp;
	<img border="0" src="images/properties_emf2.gif" align="top"></p>
	<h2>New EMF Bindings</h2>
	<p class="pnoall">New bindings are created by selecting a <b>Target</b>, a
	<b>Target Property</b>, a <b>Source</b>, a <b>Source Property</b> and 
	clicking the
	<img border="0" src="images/binding_button.gif" width="26" height="24" align="absbottom">
	<b>Bind</b> button. When creating a binding, the update strategy from <b>
	target to model</b> and <b>model to target</b> may be specified as well as 
	any strategy-specific properties (validators and converters).</p>
	<p class="pnoall">
	<img border="0" src="images/bind_properties_emf1.gif" align="top"></p>
	<p class="pnoall">When new bindings are created between a <b>Viewer</b> and 
	a list of model objects, the <b>Content Provider</b> and
	<b>Label Provider</b> may be specified. </p>
	<p class="pnoall">
	<img border="0" src="images/bind_properties_emf2.gif"></p>
	<h2>
	Source</h2>
		<p class="pnoall">As bindings are created or edited on the Bindings tab, 
		the necessary data binding 
		code is generated which may then be seen in the <b>Source</b> view. An <b>initDataBindings()</b> 
		method is created, if it does not already exist and a call to that 
		method is added to the end of the widget creation process.</p>
	<p class="pnoall">Within the <b>initDataBindings()</b> method, any needed 
	observables are created first followed by the creation of the <b>Data 
	Binding Context</b>. Simple SWT data bindings are then created using the new 
	context followed by any EMF model bindings 
	that are needed.</p>
	<p class="pnoall">
	<img border="0" src="images/data_binding_source_emf.gif"></p>
	<p class="pnoall"><i><b>Warning: </b>do not edit the <b>initDataBinding()</b> 
	method by hand (without carefully matching the code generation pattern used 
	by the tool) as it will be regenerated in its entirety any time 
	the tool 
	needs to add, remove or update a data binding.</i></p>
          </body>
</html>